package sort_util

import "fmt"

// Signed 若我们使用~int64来约束MyInt, 则Myint满足该约束(也就是说, ~int64只要求该类型的底层是int64, 也就是模糊匹配了)
//官方为了鲁棒性, 自然把所有的类型前面都加上了~
type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 | string | ~byte
}

type SortFunc[T Signed] func(list []T)

func PrintSort[T Signed](list []T, sF SortFunc[T]) {
	fmt.Println("\nBefore Sort Result:")
	for _, ele := range list {
		fmt.Printf("%v\t", ele)
	}
	sF(list)
	fmt.Println("\nAfter Sort Result:")
	for _, ele := range list {
		fmt.Printf("%v\t", ele)
	}
	fmt.Println("\n==============分界线==============")
}
